package pcjavanet.mobilesell.service;

import java.util.List;

import pcjavanet.mobilesell.model.Color; 
import pcjavanet.mobilesell.model.PageBean;
import pcjavanet.mobilesell.model.ColorExample;
import pcjavanet.mobilesell.model.QryCondition;
import pcjavanet.mobilesell.model.QryTerm;
import pcjavanet.mobilesell.persistence.ColorMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
public class ColorService {


  @Autowired
  private  ColorMapper colorMapper;


  public int  insert( Color color ) throws Exception{
	return colorMapper.insert (color);
  }


  public Color  selectByPrimaryKey( Color  bean ) {
 	int dbid = bean.getDbid();
	Color color = colorMapper.selectByPrimaryKey( dbid );
	return color ;
  }


  public int  updateByPrimaryKeySelective( Color color ) throws Exception{
	return colorMapper.updateByPrimaryKeySelective( color );
  }


  public int  deleteByPrimaryKey( Color  bean ) throws Exception{
 	int dbid = bean.getDbid();
	return colorMapper.deleteByPrimaryKey( dbid );
  }


  public List<Color>  selectByExample( Color color ) throws Exception{
    ColorExample example = new ColorExample();
	return colorMapper.selectByExample( example );
  }

  public List<Color>  getOnePageBeans( QryCondition condition , PageBean pageBean ) throws Exception{
    ColorExample example = new ColorExample();
    ServiceUtil.dealCriteria( condition,  example.createCriteria() );
	List<Color> ls=colorMapper.getOnePageBeans( example , pageBean );
//begin
	if ( ls.size() > 0 ) {
	}
//end
	return ls;
  }

  public int getTotalRecords( QryCondition condition , PageBean pageBean ) throws Exception{
    ColorExample example = new ColorExample();
    ServiceUtil.dealCriteria( condition,  example.createCriteria() );
	return colorMapper.getTotalRecords( example , pageBean );
  }

  public int countByExample( Color color , PageBean pageBean ){
    ColorExample example = new ColorExample();
	return colorMapper.countByExample( example );
  }
  public List<Color> selectByExamplePage( Color color , PageBean pageBean ){
  ColorExample example = new ColorExample();
	return colorMapper.selectByExamplePage( example , pageBean );
  }

}
